<?php
namespace app\admin\controller;
use app\admin\logic\Brand;
use app\admin\logic\Category;
use app\admin\model\Goods;
use think\facade\Cache;
use think\facade\Db;
use think\facade\Request;
use think\facade\View;

class Good{
    public function goodList()
    {
        //下拉菜单循环
        $line = Db::name('category')->select();

        View::assign('keywords','');

        //全部值
        $all = input('');
        unset($all['order']);
        View::assign('all',$all);
        View::assign($all);

       $arr1 = \app\admin\logic\Goods::setWhere();

       echo"<pre>";
       print_r($arr1['where']);
       echo"</pre>";

       $arr=Goods::getGoodsList($arr1['where'],$arr1['order'],$all);


        //赋值 渲染页面
        View::assign('list',$arr);
        View::assign('line',$line);

        return view();

    }


    public function goodBa()
    {
        View::assign($all = input(''));

        //拼装WHERE条件
        $arr = Brand::getWhere();

        echo"<pre>";
        print_r($arr['where']);
        echo"</pre>";
        //查询Brand数据

        $list = \app\admin\model\Brand::getGoodsBrand($arr['where'],$all);


        //渲染页面
        View::assign('list',$list);
        return view();

    }


    public function goodAdd()
    {
        return view();
    }


    public function cate()
    {
        $arr = Category::cateWhere();
        $ayy = new \app\admin\model\Category();
        $list = $ayy->goodsCate($arr['id']);


        View::assign('list',$list);
        return view();
    }







}